// 路由器的配置
import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home/home.vue'
Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'Home',
    component: Home,
  },
  {
    path: '/mine',
    name: 'mine',
    component: () => import('../views/Mine/mine.vue'),
  },
  {
    path: '/server',
    name: 'server',
    component: () => import('../views/Server/server.vue'),
  },
  {
    path: '/shopping',
    name: 'shopping',
    component: () => import('../views/Shopping/shopping.vue'),
  },
  {
    path: '/login',
    name: 'login',
    component: () => import('../views/Login/login.vue')
  },
  {
    path: '/search',
    name: 'search',
    component: () => import('../views/Search/search.vue')
  },
  {
    path: '/details',
    name: 'details',
    component: () => import('../views/Details/details.vue')
  }, 
  {
    path: '/resiger',
    name: 'resiger',
    component: () => import('../views/Resiger/resiger.vue')
  }
] 

const router = new VueRouter({
  routes
})
router.beforeEach((to, from, next) => {
  // chrome
  document.body.scrollTop = 0
  next()
})
export default router
